<?php
namespace zake\foundation\able\stream;


use zake\foundation\stream\WriteStream;

interface WriteAble extends ResourceAble
{
    /**
     * 写
     * @return resource
     *
     * @author liu.bin 2020-03-31 16:33
     */
    public function getWriteResource();


    /**
     *
     * @return int
     *
     * @author liu.bin 2020-04-16 09:26
     */
    public function getWriteFd();


    /**
     * 写数据
     * @param $sendData
     * @param int $mode
     * @return mixed
     *
     * @author liu.bin 2020-04-26 15:30
     */
    public function write($sendData,$mode=WriteStream::MODE_PERSIST | WriteStream::UN_ENCODE);

    /**
     * 关闭写资源
     * @return bool
     *
     * @author liu.bin 2020-04-26 10:42
     */
    public function closeWriteResource();


    /**
     * 写资源是否关闭
     * @return bool
     *
     * @author liu.bin 2020-04-26 10:42
     */
    public function isCloseWriteResource();


    /**
     * 写入时间
     *
     * @param int|null $time
     * @author liu.bin 2020-03-31 16:43
     */
    public function setWriteTime($time=null);


    /**
     * 获取上一次写入数据的时间
     *
     * @return int
     * @author liu.bin 2020-03-28 21:18
     */
    public function getWriteTime();

}